package com.fantasy.dao.impl;

import com.fantasy.dao.BaseDao;
import com.fantasy.dao.CommentDao;
import com.fantasy.entity.Comment;

import java.util.List;

public class CommentDaoImpl extends BaseDao implements CommentDao {
    @Override
    public int insert(Comment comment) {
        String sql="INSERT INTO `comment` (`userName`,`videoId`,`comment`)VALUES(?,?,?)";
        return super.update(sql,comment.getUserName(),comment.getVideoId(),comment.getComment());
    }

    @Override
    public List<Comment> queryVideoComment(int videoId) {
        String sql="SELECT * FROM `comment` WHERE `videoId` = ?";
        return super.queryForList(Comment.class,sql,videoId);
    }
}
